home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / msdos / osinline.h < prev    next >
C/C++ Source or Header  |  2000-02-07  |  1KB  |  44 lines

  1.  
  2. #ifndef __OSINLINE__
  3. #define __OSINLINE__
  4.  
  5. /* What goes herein depends heavily on the OS. */
  6.  
  7. #define DIRTY_H 256
  8. #define DIRTY_V 1600/16
  9.  
  10. extern char *dirty_new;
  11. #define osd_mark_vector_dirty(x,y) dirty_new[(y)/16 * DIRTY_H + (x)/16] = 1
  12.  
  13. #define vec_mult _vec_mult
  14. INLINE int _vec_mult(int x, int y)
  15. {
  16.     int result;
  17.     __asm__ (
  18.             "movl  %1    , %0    ; "
  19.             "imull %2            ; "    /* do the multiply */
  20.             "movl  %%edx , %%eax ; "
  21.             :  "=&a" (result)           /* the result has to go in eax */
  22.             :  "mr" (x),                /* x and y can be regs or mem */
  23.                "mr" (y)
  24.             :  "%edx", "%cc"            /* clobbers edx and flags */
  25.         );
  26.     return result;
  27. }
  28.  
  29. INLINE unsigned int osd_cycles(void)
  30. {
  31.     int result;
  32.  
  33.     __asm__ __volatile__ (
  34.         "rdtsc                 \n"    /* load clock cycle counter in eax and edx */
  35.         :  "=&a" (result)            /* the result has to go in eax */
  36.         :                            /* no inputs */
  37.         :  "%edx"                    /* clobbers edx */
  38.     );
  39.  
  40.     return result;
  41. }
  42.  
  43. #endif /* __OSINLINE__ */
  44.